<?php 
	$url = $this->baseUrl();
?>
<div class="container-fluid" style="width: 890px;">

	<div class="row-fluid" style="margin-top: 20px;">
	
		<div class="span8" style="width: 100%;">
			<div class="social-box" style="margin-bottom: 12px;">
			<div class="header">
			<h4 class="" style="margin-top: 8px !important;">
			<i class="icon-user"></i>
			Quản lý đơn hàng
			</h4>
			</div>
			<div class="body" style="position: relative;">
			
			<table class="table table-bordered" style="font-size: 12px;">
		
			<thead>
			
				<tr>
					<th>STT</th>
					<th>Order</th>
					<th style="width: 200px;">Sản phẩm</th>					
					<th style="width: 200px;">Người mua</th>
					<th>Thanh toán</th>
					<th>Tình trạng</th>
					<th>Ngày mua</th>
				</tr>
			
			</thead>
			
			<tbody>	
			
			<?php foreach( $this->list_shop as $key => $shop):?>
			
				<?php
				 $order = new Shop_Model_Order();
				 $arr = array(
					"shopid"=>$shop["id"],
				);				
				?>
			
				<?php foreach($list_order = $order->listItemProductCustomer($arr) as $key => $val):?>
				
				<tr id="row<?php echo $val["ordersid"]; ?>" class="<?php if($val["status"] == "prepare"):?> warning<?php elseif($val["status"] == "verified"):?>info<?php elseif ($val["status"] == "shipped"):?> warning<?php elseif($val["status"] == "delivered"):?>warning<?php elseif($val["status"] == "returned"):?>error<?php elseif($val["status"] == "close"):?>success<?php elseif($val["status"] == "fail"):?>error<?php endif;?>">
					<td>
						<input type="checkbox">												
					</td>
					<td>#<?php echo $val["ordersid"]?></td>
					<td>
						
						<div>
							<img src="<?php echo $url;?>/photo/<?php echo $val["image"];?>" width="100px" height="100px" style="float: left; padding-right: 5px;" />
							
							<p>
								<?php echo $val["detail"]?>							
							</p>
												
						</div>
						
					</td>
					<td>
						Tên: <?php echo $val["displayname"];?><br>
						Email: <?php echo $val["email"];?><br>
						Phone: <?php echo $val["phone"];?><br>
						Địa chỉ: <?php echo $val["address"];?><br>
						Quận/Huyện: <?php echo $val["district"];?><br>
						Tỉnh/Thành phố: <?php echo $val["province"];?><br>
						Số lượng: <?php echo $val["number"];?>
					</td>
					<td>
						<p id="loading-payment<?php echo $val["ordersid"];?>" style="display: none; text-align: center;">
							<img src="<?php echo $url;?>/application/public/images/ajax-loader.gif" />
						</p>
						<select style="width: 100px;" id="payment<?php echo $val["ordersid"];?>" onchange="updateOrdersPayment('<?php echo $val["ordersid"]?>');">
							<option value="direct" <?php if($val["payment_method"] == "direct"):?> selected="selected" <?php endif;?>>Trực tiếp</option>
							<option value="bank" <?php if($val["payment_method"] == "bank"):?> selected="selected" <?php endif;?>>Ngân hàng</option>
							<option value="cod" <?php if($val["payment_method"] == "cod"):?> selected="selected" <?php endif;?>>COD</option>
						</select>						
					</td>
					<td>
						<p id="loading-status<?php echo $val["ordersid"];?>" style="display: none; text-align: center;">
							<img src="<?php echo $url;?>/application/public/images/ajax-loader.gif" />
						</p>
						<select style="width: 100px;" id="status<?php echo $val["ordersid"];?>" onchange="updateOrdersStatus('<?php echo $val["ordersid"]?>');">						
							<option value="prepare" <?php if($val["status"] == "prepare"):?> selected="selected" <?php endif;?>>prepare</option>
							<option value="verified" <?php if($val["status"] == "verified"):?> selected="selected" <?php endif;?>>verified</option>
							<option value="shipped" <?php if($val["status"] == "shipped"):?> selected="selected" <?php endif;?>>shipped</option>
							<option value="delivered" <?php if($val["status"] == "delivered"):?> selected="selected" <?php endif;?>>delivered</option>
							<option value="returned" <?php if($val["status"] == "returned"):?> selected="selected" <?php endif;?>>returned</option>
							<option value="close" <?php if($val["status"] == "close"):?> selected="selected" <?php endif;?>>close</option>
							<option value="fail" <?php if($val["status"] == "fail"):?> selected="selected" <?php endif;?>>fail</option>
						</select>						
					</td>
					<td><?php echo $val["createdate"]?></td>
				</tr>				
				
				<?php endforeach;?>
				
			<?php endforeach;?>
				
			</tbody>		
		
		</table>

			</div>
			</div>
		</div>
			
	</div>
	
</div>
